#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "about/aboutsoftinfo.h"
#include "about/authordialog.h"
#include "threeLib/smallerShare.h"
#include "uartPort/uartcfg.h"
#include "uartPort/uartwork.h"
#include <QDateTime>
#include <QDir>
#include <QFileDialog>
#include <QFileInfo>
#include <QLineEdit>
#include <QList>
#include <QMainWindow>
#include <QMessageBox>
#include <QRegExp>
#include <QStandardPaths>
#include <QWidget>
#include <threeLib/smmovebutton.h>

extern char AT_CRLF[2];

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow {
  Q_OBJECT

public:
  explicit MainWindow(QWidget *parent = nullptr);
  ~MainWindow();
private slots:

  void setCurrentUartCfg(comcfg_t);

  void readFromCom(QByteArray);
  void on_openComs_clicked();

  void errorOccurred(QString);
  void openSucess(bool);
  void on_stopDis_clicked();

  void on_disClear_clicked();

  void on_saveFile_clicked();

  void sendText2Uart();

  void on_actionExit_triggered();

  void on_actionCfgUart_triggered();

  void on_actionSaveLog_triggered();

  void on_actionDisClear_triggered();

  void on_actionDisStop_triggered();

  void on_actionDixText_triggered();

  void on_actionDisHex_triggered();

  void on_actionaAoutSoft_triggered();

  void on_actionAboutAuthor_triggered();

  void on_actionExLog_triggered();

signals:
  void sendData2Uart(QByteArray);
  void upCfg2Uart(comcfg_t);
  void startWork(comcfg_t);
  void closeUart();
  void uartDataProc(QByteArray);

private:
  Ui::MainWindow *ui;
  smallerShare pubFun;
  QByteArray uartSrcData;
  QString logPath;
  QString savePath;
  bool disPlayerFlag;
  comcfg_t currentUartCfg;
  bool uartIsOpen;
  uartCfg *comW;
  aboutSoftInfo *softInfoW;
  AuthorDialog *authorW;
  uartWork *comThread;
  QList<QPushButton *> senBtnList;
  QList<QCheckBox *> sendHexList;
  QList<QLineEdit *> sendLineList;
};

#endif // MAINWINDOW_H
